<template>
  <el-table :data="data" class="mytable" :class="className" @row-click="$emit('handleEdit',{type:'row-click',params:$event})">
    <el-table-column
      v-for="(item, index) in config"
      :key="index"
      :prop="item.prop"
      :label="item.label"
      :width="item.width"
    >
      <template v-if="item.func">
        {{ item.func() }}
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup>
import { defineProps } from 'vue'

defineProps({
  config: {
    type: Array,
    default() {
      return []
    }
  },
  data: {
    type: Array,
    default() {
      return []
    }
  },
  className: [Array, String]
})
</script>

<style lang="scss" scoped>
.mytable {
  width: 100%;
}
</style>
